`timescale 1ns/1ps
module SecurityDoor_tb();

reg PME;
reg [1:0] PM;
reg [23:0] PC;
reg PCE;
reg [23:0] RC;
reg RCE;
reg RME;
reg [23:0] CS;
reg DOC;
reg [11:0] T;
reg [2:0] D;
reg clk;
reg rst; 

wire GLED;
wire RLED;
wire A;
wire [23:0] MO;
wire Ac;

  SecurityDoor unicorn (.PME(PME), .PM(PM), .PC(PC),.PCE(PCE),.RC(RC), .RCE(RCE), .RME(RME), .CS(CS), .DOC(DOC), .T(T), .D(D), .rst(rst), .clk(clk),
                        .GLED(GLED), .RLED(RLED), .A(A), .MO(MO), .Ac(Ac));
  


initial
begin
clk= 1'b0;
rst= 1'b0;
end

always 
begin 
#500000 clk= ~clk;
end

always
begin
#510000 rst= 1'b1;

//allow access all times 

#490000 PME= 1'b1;
#500000 PM= 2'b00;

#500000 D= 3'b001;
#500000 D= 3'b010;
#500000 D= 3'b011;
#500000 D= 3'b100;
#500000 D= 3'b101;
#500000 D= 3'b110;
#500000 D= 3'b111;

#500000 T= 12'b000001100100;
#500000 T= 12'b000011001000;
#500000 T= 12'b000100101100;
#500000 T= 12'b000110010000;
#500000 T= 12'b000111110100;
#500000 T= 12'b001001011000;
#500000 T= 12'b001010111100;
#500000 T= 12'b001100100000;
#500000 T= 12'b001110000100;
#500000 T= 12'b001111101000;
#500000 T= 12'b010001001100;
#500000 T= 12'b010010110000;
#500000 T= 12'b010100010100;
#500000 T= 12'b010101111000;
#500000 T= 12'b010111011100;
#500000 T= 12'b011001000000;
#500000 T= 12'b011010100100;
#500000 T= 12'b011100001000;
#500000 T= 12'b011101101100;
#500000 T= 12'b011111010000;
#500000 T= 12'b100000110100;
#500000 T= 12'b100010011000;
#500000 T= 12'b100011111100;
#500000 T= 12'b100101100000; 
#500000 PME= 1'b0;

#500000 PCE= 1'b1;
#500000 PC= 24'b10101110011111100001111;
#500000 PCE= 1'b0;
#500000 CS= 24'b10101110011111100001111;

#500000 RCE=1'b1;
#500000 RC= 24'b011101110111000000110010;
#500000 RCE= 1'b0;
#500000 CS= 24'b011101110111000000110010;


//Allow Access everyday from 7:00am-12pm

#500000 PME= 1'b1;
#500000 PM= 2'b01;

#500000 D= 3'b000;
#500000 D= 3'b001;
#500000 D= 3'b010;
#500000 D= 3'b011;
#500000 D= 3'b100;
#500000 D= 3'b101;
#500000 D= 3'b110;
#500000 D= 3'b111;

#500000 T= 12'b000001100100;
#500000 T= 12'b000011001000;
#500000 T= 12'b000100101100;
#500000 T= 12'b000110010000;
#500000 T= 12'b000111110100;
#500000 T= 12'b001001011000;
#500000 T= 12'b001010111100;
#500000 T= 12'b001100100000;
#500000 T= 12'b001110000100;
#500000 T= 12'b001111101000;
#500000 T= 12'b010001001100;
#500000 T= 12'b010010110000;
#500000 T= 12'b010100010100;
#500000 T= 12'b010101111000;
#500000 T= 12'b010111011100;
#500000 T= 12'b011001000000;
#500000 T= 12'b011010100100;
#500000 T= 12'b011100001000;
#500000 T= 12'b011101101100;
#500000 T= 12'b011111010000;
#500000 T= 12'b100000110100;
#500000 T= 12'b100010011000;
#500000 T= 12'b100011111100;
#500000 T= 12'b100101100000;
#500000 PME= 1'b0;

#500000 PCE= 1'b1;
#500000 PC= 24'b10101110011111100001111;
#500000 PCE= 1'b0;
#500000 CS= 24'b10101110011111100001111;

#500000 RCE=1'b1;
#500000 RC= 24'b011101110111000000110010;
#500000 RCE= 1'b0;
#500000 CS= 24'b011101110111000000110010;


//Allow access weekdays 7am-12pm an all times with credentials

#500000 PME= 1'b1;
#500000 PM= 2'b10;

#500000 D= 3'b000;
#500000 D= 3'b001;
#500000 D= 3'b010;
#500000 D= 3'b011;
#500000 D= 3'b100;
#500000 D= 3'b101;
#500000 D= 3'b110;
#500000 D= 3'b111;

#500000 T= 12'b000001100100;
#500000 T= 12'b000011001000;
#500000 T= 12'b000100101100;
#500000 T= 12'b000110010000;
#500000 T= 12'b000111110100;
#500000 T= 12'b001001011000;
#500000 T= 12'b001010111100;
#500000 T= 12'b001100100000;
#500000 T= 12'b001110000100;
#500000 T= 12'b001111101000;
#500000 T= 12'b010001001100;
#500000 T= 12'b010010110000;
#500000 T= 12'b010100010100;
#500000 T= 12'b010101111000;
#500000 T= 12'b010111011100;
#500000 T= 12'b011001000000;
#500000 T= 12'b011010100100;
#500000 T= 12'b011100001000;
#500000 T= 12'b011101101100;
#500000 T= 12'b011111010000;
#500000 T= 12'b100000110100;
#500000 T= 12'b100010011000;
#500000 T= 12'b100011111100;
#500000 T= 12'b100101100000;
#500000 PME= 1'b0;

#500000 PCE= 1'b1;
#500000 PC= 24'b10101110011111100001111;
#500000 PCE= 1'b0;
#500000 CS= 24'b10101110011111100001111;

#500000 RCE=1'b1;
#500000 RC= 24'b011101110111000000110010;
#500000 RCE= 1'b0;
#500000 CS= 24'b011101110111000000110010;



//allow access with credentials only


#500000 PME= 1'b1;
#500000 PM= 2'b11;

#500000 D= 3'b000;
#500000 D= 3'b001;
#500000 D= 3'b010;
#500000 D= 3'b011;
#500000 D= 3'b100;
#500000 D= 3'b101;
#500000 D= 3'b110;
#500000 D= 3'b111;

#500000 T= 12'b000001100100;
#500000 T= 12'b000011001000;
#500000 T= 12'b000100101100;
#500000 T= 12'b000110010000;
#500000 T= 12'b000111110100;
#500000 T= 12'b001001011000;
#500000 T= 12'b001010111100;
#500000 T= 12'b001100100000;
#500000 T= 12'b001110000100;
#500000 T= 12'b001111101000;
#500000 T= 12'b010001001100;
#500000 T= 12'b010010110000;
#500000 T= 12'b010100010100;
#500000 T= 12'b010101111000;
#500000 T= 12'b010111011100;
#500000 T= 12'b011001000000;
#500000 T= 12'b011010100100;
#500000 T= 12'b011100001000;
#500000 T= 12'b011101101100;
#500000 T= 12'b011111010000;
#500000 T= 12'b100000110100;
#500000 T= 12'b100010011000;
#500000 T= 12'b100011111100;
#500000 T= 12'b100101100000;
#500000 PME= 1'b0;

#500000 PCE= 1'b1;
#500000 PC= 24'b10101110011111100001111;
#500000 PCE= 1'b0;
#500000 CS= 24'b10101110011111100001111;

#500000 RCE=1'b1;
#500000 RC= 24'b011101110111000000110010;
#500000 RCE= 1'b0;
#500000 CS= 24'b011101110111000000110010;

end

endmodule
